<%--
 *  File:    ComboCodeSegValueSummary.jsp
 *  @Author: Hilldao
 *  Date:    2002/1/8
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.OvalLabel" %>
<%@ page import="com.oval.util.OvalCustomColumn" %>
<%@ page import="com.oval.util.OvalCustomMessage" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.ComboCodeSegValueSummary");
  String strTableName = "ovcombocodesegmentvalue";
  String strModuleName = "SPM";
  String privilegeCode = "Z0607,Z0614";
%>



<%
  //get userinfo
  HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");

  String strsegmentid = "";
  if(request.getParameter("segmentid")!=null)
  {
    strsegmentid = request.getParameter("segmentid");
  }
  String isFinish = (String)session.getAttribute("isfinishsession");
  if(isFinish==null)
  {
    isFinish="";
  }

%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title></title>
<PageFlow:CheckPageFlow pageName="combocodesegvaluesummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>
<%if(isFinish.equals("Y")){%>
   opener.page_valueList();
<%}%>

function clickCy()
{
  if(combocodesegvalueform.cych.checked)
    combocodesegvalueform.isdefault.value = "Y";
  else
    combocodesegvalueform.isdefault.value = "N";
  return;
}

function item_onclick(i,clickid)
{
  var itemname = ""+i;
  <%--[SCRIPT]  alert(document.combocodesegvalueform.valueids[i].value);  [SCRIPT]--%>
  if(document.all.item("combocodesegvalue"+i).checked == true)
  {
    document.combocodesegvalueform.valueids[i].value = clickid;
  }
  else
  {
    document.combocodesegvalueform.valueids[i].value = -1;
  }
}
function page_delete()
{
    var isSelectItem = false;
	  var checkitem = document.all.item('valueids');
	  for(var i = 0; i<checkitem.length;i++)
	  {
	    <%--[SCRIPT]  alert("i->"+i+"-->"+checkitem[i].value);  [SCRIPT]--%>
	    if(checkitem[i].value!=-1)
	    {
	      isSelectItem = true;
	      break;
	    }
	  }
	  if(isSelectItem)
	  {
		  var flag = confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>");
		  if(!flag)
		    return;
		  document.combocodesegvalueform.isfinishsession.value = "Y";
		  document.combocodesegvalueform.actionname.value = "delete";
		  isRunning = true;
		  document.combocodesegvalueform.submit();
		}
}
function page_add()
{
  document.combocodesegvalueform.isfinishsession.value ="Y";
  document.combocodesegvalueform.actionname.value = "add";
	document.combocodesegvalueform.submit();
}
function resetall()
{
  document.combocodesegvalueform.reset();
}
function selectall()
{
  var allcheck = document.all.item("combocodesegvalue");
  if(allcheck==null) return;
  if(allcheck.length!=null)
  {
    for(var i = 0;i<allcheck.length;i++)
    {
       allcheck[i].checked = true;
    }
  }
  else if(allcheck!=null)
  {
    allcheck.checked = true;
  }
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(combocodesegvalueform,actionvalue,orderbyname);
  editform.action = "ComboCodeSegValueSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
</script>
<%
  cat.debug("The strCurSearchName is :" + strCurSearchName);
  cat.debug("The strCurSearchValue is :" + strCurSearchValue);
  cat.debug("The strCurOrderByCol is :" + strCurOrderByCol);
  cat.debug("The strCurOrderByType is :" + strCurOrderByType);
  cat.debug("The nCurMaxItem is :" + nCurMaxItem);
  cat.debug("The nCurCount is :" + nCurCount);
  cat.debug("The nCurPageNo is :" + nCurPageNo);
  cat.debug("The nCurTotalPage is :" + nCurTotalPage);
  cat.debug("The nCurEndIndex is :" + nCurEndIndex);
  cat.debug("The bCurHasPre is :" + bCurHasPre);
  cat.debug("The bCurHasNext is :" + bCurHasNext);
  cat.debug("The CurUserInfo is :" + CurUserInfo);

  Vector ComboCodeSegValueSummary = (Vector)pageContext.getAttribute("allcombocodesegvalues");

  if(ComboCodeSegValueSummary == null||isFinish.equals("Y"))
  {
    ComboCodeSegValueSummary = new Vector();
  }
  cat.debug("The ComboCodeSegValueSummary is :" + ComboCodeSegValueSummary);
%>
</head>
<body>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="combocodesegvalueform" method="post" action="../../Dispatcher"  target="_parent">
   <input type="hidden" name="pagename" value="combocodesegvaluesummary">
	 <input type="hidden" name="actionname">
	 <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">

	 <input type="hidden" name="segmentid" value="<%=JspHelper.filterNull(strsegmentid)%>">
	 <input type="hidden" name="isfinishsession" >

  <tr>
    <td>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="2" class="summary_top"></td>
        </tr>
        <tr>
          <td colspan="2"><img src="../../images/<%= strLanguageCode %>/quote.gif" width="16" height="11">
            <%= label.getLabelName("L_SegmentList") %><%= label.getLabelName("L_Colon") %></td>
        </tr>
      </table>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">

        <tr class="deepblue-left" >
            <td class="title_center" width="5">&nbsp;</td>
            <td class="title_center"  >&nbsp;<a href="javascript:page_summary('orderby','value')"><%= label.getLabelName("L_Value") %></a></td>
            <td class="title_center"  >&nbsp;<a href="javascript:page_summary('orderby','isdefault')"><%= label.getLabelName("L_DefaultValue") %></a></td>
        </tr>


        <%
             int j = 0;
             String strClassType = new String();
          %>
          <logic:iterate id="ComboCodeSegValue" collection="<%= ComboCodeSegValueSummary %>">
         <%
            HashMap ComboCodeSegValueMap = (HashMap)pageContext.getAttribute("ComboCodeSegValue");

            String strIsDisabled = new String("");

            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }
            j++;
          %>

          <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:checktrue('combocodesegvalue<%=JspHelper.filterNull(j)%>');item_onclick('<%=JspHelper.filterNull(j)%>','<%=JspHelper.filterNull(ComboCodeSegValueMap.get("valueid"))%>')" class="<%=JspHelper.filterNull(strClassType)%>">
            <input type="hidden" name="valueids" value="-1">
            <td width="5">
              <input id="combocodesegvalue<%=JspHelper.filterNull(j )%>" type="checkbox" name="combocodesegvalue"  onClick="javascript:checktrue('combocodesegvalue<%=JspHelper.filterNull(j)%>');item_onclick('<%=JspHelper.filterNull(j)%>','<%=JspHelper.filterNull(ComboCodeSegValueMap.get("valueid"))%>')" value=<%=JspHelper.filterNull( ComboCodeSegValueMap.get("valueid") )%> class="checkbox" >
            </td>
            <td>&nbsp;<%=JspHelper.filterNull( ComboCodeSegValueMap.get("value") )%></td>
            <td>&nbsp;<%=JspHelper.filterNull( ComboCodeSegValueMap.get("isdefault") )%></td>
          </tr>
          </logic:iterate>
          <tr>
            <td width="5">&nbsp;</td>
            <td><input name="value"></td>
            <td><input type="checkbox" name="cych" onclick="javascript:clickCy();" value="checkbox" class="normalradio">
                <input type="hidden" name="isdefault" value="N">
         </tr>

          <input type="hidden" name="valueids" value="-1">
          <input type="hidden" name="valueids" value="-1">

    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryActionPop.inc" %>
      </table>
    </td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>
  <tr>
    <td class="td_center">
      <a onclick="selectall()"><custom:button type="1" label="L_Saveall" imgsrc="saveall.gif" border="0" style="width:60"/></a>
      <a onclick="resetall()"><custom:button type="1" label="L_Resetmarks" imgsrc="resetmarks.gif" border="0"/></a>
      <a onclick="page_add()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
      <a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
    </td>
  </tr>
</table>
</body>
</html>


